Imports System.Collections.Generic
Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Web.Script.Services
Imports System.Data
Imports Bussines.logic
Imports Bussines.entity
<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<System.Web.Script.Services.ScriptService()> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class WSbusquedas
    Inherits System.Web.Services.WebService

    <WebMethod()> _
    Public Function HelloWorld() As String
        Return "Hello World"
    End Function

    <WebMethod()> _
    Public Function ListarResponsable(ByVal prefixText As String) As String()
        Dim usuario As New usuariosBL
        Dim dt As New DataTable
        'dt.Columns.Add(New DataColumn("ID", Type.GetType("System.String")))
        'dt.Columns.Add(New DataColumn("nombre", Type.GetType("System.String")))
        'Dim dr As DataRow = dt.NewRow
        'dr("ID") = "1"
        'dr("nombre") = "demo"
        'dt.Rows.Add(dr)
        'dr = dt.NewRow
        'dr("ID") = "2"
        'dr("nombre") = "demo2"
        'dt.Rows.Add(dr)

        dt = usuario.listarUsuario(prefixText)
        Dim items(dt.Rows.Count - 1) As String
        If (dt.Rows.Count > 0) Then
            For x As Integer = 0 To dt.Rows.Count - 1
                'items(x) = AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(String.Format("{0}", dt.Rows(x).Item("nombre")), dt.Rows(x).Item("ID"))
                items(x) = AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(String.Format("{0}", dt.Rows(x).Item("NOMBRE")), String.Format("{0}|{1}|{2}", dt.Rows(x).Item("ID"), dt.Rows(x).Item("directory"), dt.Rows(x).Item("cargo")))
            Next
        End If

        'Dim i As Integer = 0
        'items(0) = AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(String.Format("{0}", "Responsable 1", "dest1"), "1")
        'items(1) = AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(String.Format("{0}", "Responsable 2", "dest1"), "2")
        'items(2) = AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(String.Format("{0}", "Responsable 3", "dest1"), "3")
        'items(3) = AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(String.Format("{0}", "Responsable 4", "dest1"), "4")
        'items(4) = AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(String.Format("{0}", "Responsable 5", "dest1"), "5")
        'items(4) = AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(String.Format("{0}", "Responsable 6", "dest1"), "6")
        Return items
    End Function

    <WebMethod()> _
    Public Function ListarModerador(ByVal prefixText As String) As String()
        Dim usuario As New usuariosBL
        Dim dt As New DataTable
        'dt.Columns.Add(New DataColumn("ID", Type.GetType("System.String")))
        'dt.Columns.Add(New DataColumn("nombre", Type.GetType("System.String")))
        'Dim dr As DataRow = dt.NewRow
        'dr("ID") = "1"
        'dr("nombre") = "demo"
        'dt.Rows.Add(dr)
        'dr = dt.NewRow
        'dr("ID") = "2"
        'dr("nombre") = "demo2"
        'dt.Rows.Add(dr)

        dt = usuario.listarUsuario(prefixText)
        'dt = usuario.listarUsuarioTodos(prefixText)
        Dim items(dt.Rows.Count - 1) As String
        If (dt.Rows.Count > 0) Then
            For x As Integer = 0 To dt.Rows.Count - 1
                ' items(x) = AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(String.Format("{0}", dt.Rows(x).Item("nombre")), dt.Rows(x).Item("ID"))
                items(x) = AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(String.Format("{0}", dt.Rows(x).Item("NOMBRE")), String.Format("{0}|{1}|{2}", dt.Rows(x).Item("ID"), dt.Rows(x).Item("CARGO"), dt.Rows(x).Item("directory")))
            Next
        End If

        'Dim i As Integer = 0
        'items(0) = AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(String.Format("{0}", "Responsable 1", "dest1"), "1")
        'items(1) = AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(String.Format("{0}", "Responsable 2", "dest1"), "2")
        'items(2) = AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(String.Format("{0}", "Responsable 3", "dest1"), "3")
        'items(3) = AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(String.Format("{0}", "Responsable 4", "dest1"), "4")
        'items(4) = AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(String.Format("{0}", "Responsable 5", "dest1"), "5")
        'items(4) = AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(String.Format("{0}", "Responsable 6", "dest1"), "6")
        Return items
    End Function

    <WebMethod()> _
    Public Function ListarSecretario(ByVal prefixText As String) As String()
        Dim usuario As New usuariosBL
        Dim dt As New DataTable
        'dt.Columns.Add(New DataColumn("ID", Type.GetType("System.String")))
        'dt.Columns.Add(New DataColumn("nombre", Type.GetType("System.String")))
        'Dim dr As DataRow = dt.NewRow
        'dr("ID") = "1"
        'dr("nombre") = "demo"
        'dt.Rows.Add(dr)
        'dr = dt.NewRow
        'dr("ID") = "2"
        'dr("nombre") = "demo2"
        'dt.Rows.Add(dr)

        dt = usuario.listarUsuario(prefixText)

        Dim items(dt.Rows.Count - 1) As String
        If (dt.Rows.Count > 0) Then
            For x As Integer = 0 To dt.Rows.Count - 1
                items(x) = AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(String.Format("{0}", dt.Rows(x).Item("nombre")), dt.Rows(x).Item("ID"))
            Next
        End If

        'Dim i As Integer = 0
        'items(0) = AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(String.Format("{0}", "Responsable 1", "dest1"), "1")
        'items(1) = AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(String.Format("{0}", "Responsable 2", "dest1"), "2")
        'items(2) = AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(String.Format("{0}", "Responsable 3", "dest1"), "3")
        'items(3) = AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(String.Format("{0}", "Responsable 4", "dest1"), "4")
        'items(4) = AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(String.Format("{0}", "Responsable 5", "dest1"), "5")
        'items(4) = AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(String.Format("{0}", "Responsable 6", "dest1"), "6")
        Return items
    End Function

    <WebMethod()> _
    Public Function ListarFacilitador(ByVal prefixText As String) As String()
        Dim usuario As New usuariosBL
        Dim dt As New DataTable

        dt = usuario.listarUsuario(prefixText)
        'dt = usuario.listarUsuarioTodos(prefixText)
        Dim items(dt.Rows.Count - 1) As String
        If (dt.Rows.Count > 0) Then
            For x As Integer = 0 To dt.Rows.Count - 1
                'items(x) = AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(String.Format("{0}", dt.Rows(x).Item("nombre")), dt.Rows(x).Item("ID"))
                items(x) = AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(String.Format("{0}", dt.Rows(x).Item("NOMBRE")), String.Format("{0}|{1}|{2}", dt.Rows(x).Item("ID"), dt.Rows(x).Item("CARGO"), dt.Rows(x).Item("directory")))
            Next
        End If
        Return items
    End Function

    <WebMethod()> _
    Public Function ListarArea(ByVal prefixText As String) As String()
        Dim area As New areasBL
        Dim dt As New DataTable

        dt = area.BuscarAreas(prefixText)
        Dim items(dt.Rows.Count - 1) As String
        If (dt.Rows.Count > 0) Then
            For x As Integer = 0 To dt.Rows.Count - 1
                items(x) = AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(String.Format("{0}", dt.Rows(x).Item("Descripcion")), dt.Rows(x).Item("id"))
            Next
        End If
        Return items
    End Function

    <WebMethod()> _
    Public Function ListarAsunto(ByVal prefixText As String, ByVal count As Integer, ByVal contextKey As String) As String()
        Dim asunto As New asuntoBL
        Dim dt As New DataTable

        dt = asunto.buscarAsuntosPorEquipo(prefixText, contextKey)
        Dim items(dt.Rows.Count - 1) As String
        If (dt.Rows.Count > 0) Then
            For x As Integer = 0 To dt.Rows.Count - 1
                items(x) = AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(String.Format("{0}", dt.Rows(x).Item("Descripcion")), dt.Rows(x).Item("id"))
            Next
        End If
        Return items
    End Function

    <WebMethod()> _
    Public Function ListarAsistentes(ByVal prefixText As String) As String()
        Dim usuario As New usuariosBL
        Dim dt As New DataTable
        'dt.Columns.Add(New DataColumn("ID", Type.GetType("System.String")))
        'dt.Columns.Add(New DataColumn("nombre", Type.GetType("System.String")))
        'Dim dr As DataRow = dt.NewRow
        'dr("ID") = "1"
        'dr("nombre") = "demo"
        'dt.Rows.Add(dr)
        'dr = dt.NewRow
        'dr("ID") = "2"
        'dr("nombre") = "demo2"
        'dt.Rows.Add(dr)

        dt = usuario.listarUsuarioTodos(prefixText)
        Dim items(dt.Rows.Count - 1) As String
        If (dt.Rows.Count > 0) Then
            For x As Integer = 0 To dt.Rows.Count - 1
                items(x) = AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(String.Format("{0}", dt.Rows(x).Item("NOMBRE")), String.Format("{0}|{1}|{2}", dt.Rows(x).Item("ID"), dt.Rows(x).Item("CARGO"), dt.Rows(x).Item("directory")))
            Next
        End If

        'items(1) = AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(String.Format("{0}", "Asistente 1"), String.Format("{0}|{1}", "1", "cargo 1"))
        'items(2) = AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(String.Format("{0}", "Asistente 2"), String.Format("{0}|{1}", "2", "cargo 2"))
        'items(3) = AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(String.Format("{0}", "Asistente 3"), String.Format("{0}|{1}", "3", "cargo 3"))
        'items(4) = AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(String.Format("{0}", "Asistente 4"), String.Format("{0}|{1}", "4", "cargo 4"))
        'items(5) = AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(String.Format("{0}", "Asistente 5"), String.Format("{0}|{1}", "5", "cargo 5"))
        'items(0) = AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(String.Format("{0}", "Asistente 6"), String.Format("{0}|{1}", "6", "cargo 6"))

        Return items
    End Function

End Class
